<include file="common/hearder"/>

<div class="page-header">
    <div class="pull-left" style="margin-left: 40%;color: #2b542c">
        <h3>部门信息管理</h3>
    </div>
</div>
<br><br>
<div class="pull-right">
    <form class="form-inline" action="{:U('index')}">
        <div class="form-group" >
        <div class="input-group">
        <div class="input-group-addon">搜</div>
        <input type="text" name="value" class="form-control" id="exampleInputAmount" placeholder="{$value ? $value : '请输入关键信息'}">
        <div class="input-group-addon">索</div>
        </div>
        </div>
        <button type="submit" value="1" name="search" class="btn btn-primary">查询</button>
        </form>
</div>
<div class="manage-left">
    <a class="btn btn-default" href="{:U('add')}">添加</a>
    <a class="btn btn-default" onclick="$('#hide').submit();">批量隐藏</a>
    <a href="{:U('new_index')}" class="btn btn-default" onclick="$('#hide').submit();">回收站</a>
</div>
<div class="clearfix"></div>
<div class="table-margin">
    <form id="hide" class="am-form" action="{:U('hide_all')}">
    <table class="table table-bordered table-header">
        <thead>
        <tr>
        <td><input type="checkbox" class="check_all"></td>
        <td >部门编号</td>
        <td>公司编号</td>
        <td>部门名称</td>
        <td>管辖范围</td>
        <td>状态</td>
        <td>操作</td>
        </tr>
        <foreach name="list" item="dpt">
        <tr class="active">
        <td><input type="checkbox" class="check_a" name="dpt_id[]" value="{$dpt.dpt_id}"></td>
        <td class="warning">{$dpt.dpt_id}</td>
        <td class="warning">{$dpt['cmpy_id']==1?'恩腾科技':'禁用'}</td>
        <td class="warning">{$dpt.dpt_name}</td>
        <td class="warning">{$dpt.dpt_bility}</td>
        <td class="warning">{$dpt['state']==1?'启用':'禁用'}</td>
        <td>
        <a href="{:U('edit',array('dpt_id'=>$dpt['dpt_id']))}" class="glyphicon glyphicon-pencil" style="text-decoration: none;">编辑</a>
        <a href="{:U('del',array('dpt_id'=>$dpt['dpt_id']))}" class="glyphicon glyphicon-trash" style="text-decoration: none;">隐藏</a>
        </td>
        </tr>
        </foreach>
        </tbody>
    </table>
    </form>
    <div class="am-cf">
        <div class="font" style="margin-left: 20px">
        共 {$count} 条记录
        </div>
            <div class="show_page" style="float: right">{$show}</div>
    </div>
</div>
</div>
<script>
    <!--  全选和反选prop(); prop()方法设置或返回被选元素的属性和值-->
    $('.check_all').on('click',function () {
        if($(this).prop('checked')){
            $('.check_a').each(function () {
                if($(this).prop('checked')){
                    $(this).prop('checked',false);
                }else{
                    $(this).prop('checked',true);
                }
            });
        }else{
            $('.check_a').prop('checked',false);
        }
    });
</script>
<include file="common/footer"/>